import React from 'react';

const FunctionSelector = ({ functions, onFunctionSelect }) => {
    const handleCheckboxChange = (e) => {
        const selectedFunctions = [];
        const checkboxes = document.querySelectorAll('input[type="checkbox"]:checked');
        checkboxes.forEach((checkbox) => {
            selectedFunctions.push(checkbox.value);
        });
        onFunctionSelect(selectedFunctions);
    };

    return (
        <div>
            <h3>Select functions to generate tests for:</h3>
            {functions.map((func, index) => (
                <div key={index}>
                    <input
                        type="checkbox"
                        value={func}
                        onChange={handleCheckboxChange}
                    />
                    <label>{func}</label>
                </div>
            ))}
        </div>
    );
};

export default FunctionSelector;